]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot-ui: Add IconLabelButton
authorIvan Molodetskikh <yalterz@gmail.com>
Mon, 16 Aug 2021 07:29:26 +0000 (10:29 +0300)
committerMarge Bot <marge-bot@gnome.org>
Thu, 27 Jan 2022 22:25:42 +0000 (22:25 +0000)
A button that has an icon and a subtitle label.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>

data/theme/gnome-shell-sass/widgets/_screenshot.scss
js/ui/screenshot.js

index aa1a11a8c8cd5f0640ab0a48e8b1f4e321d7a27f..5c98fce29938e6bb5d7444a961c76032160a53c5 100644 (file)
@@ -1,4 +1,13 @@
 // Screenshot UI
+.icon-label-button-container {
+  spacing: $base_spacing;
+  font-size: $base_font_size - 3pt;
+
+  StIcon {
+    icon-size: 32px;
+  }
+}
+
 .screenshot-ui-panel {
   background-color: $osd_bg_color;
   border-radius: 12px + 21px;
index 548df498ee9cac1841cd14cf5501662753063ae1..17e61531ec248de4c8fb588274629b45b45b8f11 100644 (file)
@@ -20,6 +20,25 @@ const { DBusSenderChecker } = imports.misc.util;
 
 const ScreenshotIface = loadInterfaceXML('org.gnome.Shell.Screenshot');
 
+var IconLabelButton = GObject.registerClass(
+class IconLabelButton extends St.Button {
+    _init(iconName, label, params) {
+        super._init(params);
+
+        this._container = new St.BoxLayout({
+            vertical: true,
+            style_class: 'icon-label-button-container',
+        });
+        this.set_child(this._container);
+
+        this._container.add_child(new St.Icon({ icon_name: iconName }));
+        this._container.add_child(new St.Label({
+            text: label,
+            x_align: Clutter.ActorAlign.CENTER,
+        }));
+    }
+});
+
 var ScreenshotUI = GObject.registerClass(
 class ScreenshotUI extends St.Widget {
     _init() {